package cn.bdqn.activity02;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class ThreeActivity extends AppCompatActivity{
    private Button btnReturnThree;
    private TextView tv_three;
    private   Intent intent;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_three);

        tv_three=findViewById(R.id.tv_three);
        btnReturnThree=findViewById(R.id.btn_returnThree);
        //接受OneActivity传过来的
        tv_three.setText(intent.getStringExtra("msg"));
        btnReturnThree.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (v.getId()==R.id.btn_returnTwo){
                    intent=getIntent();
                    intent.putExtra("threemsg","恭喜你到C页面,不欢迎你，走开");
                    setResult(RESULT_OK,intent);//ok=-1代表成果
                    finish();//当前关闭，返回one
                }
            }
        });
    }


}
